package com.banmao.mall.controller.client;

import com.banmao.mall.model.vo.BaseRespVO;
import com.banmao.mall.model.vo.client.catalog.CategoryIndexVO;
import com.banmao.mall.model.vo.client.catalog.CurrentVO;
import com.banmao.mall.service.client.CatalogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/wx/catalog")
public class CatalogController {
    @Autowired
    CatalogService catalogService;
    //获取类目，包含所有一级类目、当前一级类目和其的二级类目
    @RequestMapping("/index")
    public BaseRespVO indnex() {
        CategoryIndexVO categoryIndexVO = catalogService.index();
        return BaseRespVO.ok(categoryIndexVO);
    }

    //获取相应一级类目的二级类目
    @RequestMapping("/current")
    public BaseRespVO current(Integer id) {
        CurrentVO currentVO = catalogService.current(id);
        return BaseRespVO.ok(currentVO);
    }
}
